package com.example.p231commandlinerunner2;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

import static org.slf4j.LoggerFactory.*;

@SpringBootApplication
public class P231CommandLineRunner2Application {

    protected final Logger logger = LoggerFactory.getLogger(getClass());

    public static void main(String[] args) {

        SpringApplication.run(P231CommandLineRunner2Application.class, args);
    }

    @Bean
    public CommandLineRunner commandLineRunner() {
        return args-> {
            logger.info("CommandLineRunner executed as a bean definition with "
                    +args.length+" arguments");
            for (String arg : args) {
                logger.info("Argument: " + arg);
            }
        };
    }

}
